# -*- coding: utf-8 -*-
# get file md5  code 
# python 2.7 

import hashlib

def getmd5(filename):

    mhash = hashlib.md5()

    with open(filename,'rb') as fobj:
        while True:
            data = fobj.read(40960)
            if not data:
                break
            mhash.update(data)  
    
    return mhash.hexdigest()    

#reload(sys)
#sys.setdefaultencoding('utf8')

print(getmd5('xxx'))

